/*
 * Copyright (c) 2022-2022 All rights Reserved.
 */

package com.driving.core.base;

import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 基础Model，对Model的扩展
 *
 * @param <T> 需要操作的数据对象
 * @author SAGITTAR
 * @see Model
 * @since 2017
 */
@Getter
@Setter
@NoArgsConstructor
public abstract class AbstractModel<T extends AbstractModel<T>> extends Model<T> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    public AbstractModel(Integer id) {
        this.id = id;
    }

    @Override
    public Serializable pkVal() {
        return id;
    }
}
